package com.ujoku.controller;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.labillusion.core.platform.web.rest.RESTController;
import com.labillusion.core.rest.client.SimpleHttpClient;
import com.ujoku.context.ActionContext;
import com.ujoku.domain.*;
import com.ujoku.service.CMSContentService;
import com.ujoku.service.FavoriteService;
import com.ujoku.service.GoodsService;
import com.ujoku.view.builder.ActivityViewBuilder;
import com.ujoku.view.domain.ActivityView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by Andy.Lian on 2015/3/10.
 */
@Controller
public class AreaController extends RESTController {

    @Value("#{configProperties['settings.prov.area']}")
    private String areaWebsite;

    @RequestMapping(value = "/uj-admin/area/{id}",method = RequestMethod.GET)
    @ResponseBody
    public List<AddressLinkage> get(@PathVariable String id) throws Exception {

        SimpleHttpClient client = new SimpleHttpClient();
        //client.setDomain(areaWebsite);

        List<AddressLinkage> areaList = client.get(areaWebsite + id,List.class);

        return areaList;
    }
}
